<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        //创建Ajax对象的实例
        let xhr = new XMLHttpRequest();
        //打开连接
        xhr.open('GET','http://localhost:8080',true);
        //指定成功的回调， 等客户端读取完响应信息后对执行onload回调函数
        xhr.onload = ()=>{
            console.log(xhr.responseText)
        }
        //发送请求给服务器
        xhr.send();
    </script>
</body>
</html>